package com.webull.information.center.common.util;

import com.webull.framework.mvc.ApiException;

/**
 * @author chengang
 * @version 1.0
 * @date 16-5-17
 * @time 下午12:28
 * @since JDK 1.8
 */
public class CenterExceptionUtil {

    public static ApiException createCenterException(String code) {
        return new ApiException(getExceptionCode(code), CodeUtil.getZH_Value(code));
    }

    public static ApiException createCenterException(String code, String remarkMsg) {
        return new ApiException(getExceptionCode(code), CodeUtil.getZH_Value(code) + "," + remarkMsg);
    }

    private static String getExceptionCode(String code) {
        String prefix = CodeUtil.getZH_Value("prefix");
        StringBuilder stbd = new StringBuilder(prefix);
        stbd.append(code);
        return stbd.toString();
    }
}
